CSharpTest.Net
Broadcast(Int32,String,String[]) Method
See Also  Example Send Feedback Download Help File
CSharpTest.Net.Library Assembly > CSharpTest.Net.IpcChannel Namespace > IpcEventChannel Class > Broadcast Method : Broadcast(Int32,String,String[]) Method

waitTime
eventName
arguments

Glossary Item Box

Sends the event to all channel subscribers, waiting at most waitTime

Syntax

Visual Basic (Declaration) 
Public Overloads Function Broadcast( _
   ByVal waitTime As Integer, _
   ByVal eventName As String, _
   ByVal ParamArray arguments() As String _
) As Integer
C# 
public int Broadcast( 
   int waitTime,
   string eventName,
   params string[] arguments
)

Parameters

waitTime
eventName
arguments

Example

Library/Library.Test/TestIpcChannel.cs

C#Copy Code
using (IpcEventChannel ch1 = new IpcEventChannel(_registrar, _channel))
using (IpcEventChannel sender = new IpcEventChannel(_registrar, _channel))
{
    ch1.StartListening("ch1");

    ManualResetEvent ready = new ManualResetEvent(false);
    ManualResetEvent die = new ManualResetEvent(false);
    ch1["Message"].OnEvent += delegate(object o, IpcSignalEventArgs e)
    {
        ready.Set();
        die.WaitOne();
        Thread.CurrentThread.Abort();
    };

    sender.Broadcast(100, "Message");
    Assert.IsTrue(ready.WaitOne(1000, false));

    sender.EnableAsyncSend();
    sender.Broadcast(0, "Message");
    die.Set();
    sender.StopAsyncSending(true, 1000);
    ch1.StopListening();
}
VB.NETCopy Code
Using ch1 As New IpcEventChannel(_registrar, _channel)
    Using sender As New IpcEventChannel(_registrar, _channel)
        ch1.StartListening("ch1")

        Dim ready As New ManualResetEvent(False)
        Dim die As New ManualResetEvent(False)
        ch1("Message").OnEvent += Function(o As Object, e As IpcSignalEventArgs) Do
            ready.[Set]()
            die.WaitOne()
            Thread.CurrentThread.Abort()
        End Function

        sender.Broadcast(100, "Message")
        Assert.IsTrue(ready.WaitOne(1000, False))

        sender.EnableAsyncSend()
        sender.Broadcast(0, "Message")
        die.[Set]()
        sender.StopAsyncSending(True, 1000)
        ch1.StopListening()
    End Using
End Using

Requirements

Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7

See Also

Generated with Document! X 2011 by Innovasys